package com.cesgroup.zw.spring.boot.library.echarts.pieAndGauge.complex;

import com.cesgroup.zw.spring.boot.charts.model.IChartsParam;
import com.cesgroup.zw.spring.boot.charts.model.IComponent;
import com.cesgroup.zw.spring.boot.echarts.build.EChartsOption;
import com.cesgroup.zw.spring.boot.echarts.component.Tooltip;
import com.cesgroup.zw.spring.boot.echarts.component.graphic.Graphic;
import com.cesgroup.zw.spring.boot.echarts.component.graphic.element.AbstractElement;
import com.cesgroup.zw.spring.boot.echarts.component.graphic.element.TextElement;
import com.cesgroup.zw.spring.boot.echarts.enums.Align;
import com.cesgroup.zw.spring.boot.echarts.enums.GraphicType;
import com.cesgroup.zw.spring.boot.echarts.enums.Trigger;
import com.cesgroup.zw.spring.boot.echarts.model.custom.style.TextStyle;

import java.util.ArrayList;
import java.util.List;

/**
 * <p>饼图和仪表盘</p>
 * @author ytj
 * @date 2019/7/4 16:56
 */
@SuppressWarnings("serial")
public class ComplexPieAndGaugeOption extends EChartsOption{
    public ComplexPieAndGaugeOption(ComplexPieAndGaugeParam param){
        this.setBackgroundColor("#010219");
        this.setTooltip(new Tooltip(){{
            this.setTrigger(Trigger.item);
        }});
        this.setGraphic(new Graphic(){{
            List<AbstractElement> list=new ArrayList<>();
            list.add(new TextElement(){{
                this.setType(GraphicType.text);
                this.setLeft(Align.center);
                this.setTop("52%");
                this.setStyle(new TextStyle(){{
                    this.setText("实时风险");
                    this.setFill("#797979");
                    this.setFont("normal 24px 'Microsoft YaHei', sans-serif");
                }});
            }});
            this.setElements(list);
        }});
    }
}
